home *** CD-ROM | disk | FTP | other *** search
- /*
- sc_pdl_rsrc_readr.c - pdl resource reader
- */
- #include "sc.h"
- #include "pdl_data.h"
- #include "sc_pdl_dat.h"
- #include "sc_filter.h"
-
- #define PDLc_id 256
- #define PDLs_id 256
-
-
- /*
- fill in the names in cnt_tab from the field opcode pointed to
- by a_cres
- */
- void name_counts(nd_res*,cnt_tab*);
- void name_counts(a_cres,acnt_tab)
- nd_res* a_cres;
- cnt_tab *acnt_tab;
- {register long counter_num;
- acnt_tab->tab_nam=a_cres->nd_str; /*name the table*/
- a_cres++; /*skip the field opcode, to the names*/
- while((a_cres->nd_type==IS_NAME)||
- (a_cres->nd_type==IS_PROTO)) {
- /* see which counter to name */
- counter_num=a_cres->nd_value;
- /*can't have values out of the counter range*/
- if((counter_num<0)||
- (counter_num>=CNT_SIZE))
- bomb(BOMB_nopdl,0,BMB_no_special);
- /* remember the counter name*/
- acnt_tab->acnt_tab[counter_num].filname=a_cres->nd_str;
- /* want to default to rejecting packets for this counter?*/
- if((a_cres->nd_cntr_flags&CNTR_reject_real)!=0)
- acnt_tab->acnt_tab[counter_num].reject=1; /*yes, set reject bit*/
- acnt_tab->acnt_tab[counter_num].filflags=a_cres->nd_cntr_flags;
- a_cres++; /* step to the next opcdode */
- }
- }
-
- /*
- pdl_opn_res - open and load the pdl resource
- */
- void pdl_opn_res()
- {int old_res;
- uint8 **pdl_cod_handle; /*pdl string data structure handle */
- uint8 **pdl_str_handle; /*pdl code data structure handle */
-
- old_res=CurResFile();
-
- gl.pdl_res=OpenResFile("\ppdl.rsrc");
- if(gl.pdl_res == -1)
- bomb(BOMB_nopdl,ResError(),BMB_no_special);
- UseResFile(gl.pdl_res);
-
- pdl_str_handle=(uint8 **)GetResource('PDLs',PDLs_id);
- if(pdl_str_handle==NIL)
- bomb(BOMB_nopdl,ResError(),BMB_no_special);
- HLock(pdl_str_handle);
- gl.pdl_str_ptr= *pdl_str_handle;
-
- pdl_cod_handle=(uint8 **)GetResource('PDLc',PDLc_id);
- if(pdl_cod_handle==NIL)
- bomb(BOMB_nopdl,ResError(),BMB_no_special);
- HLock(pdl_cod_handle);
- gl.pdl_cod_ptr= *pdl_cod_handle;
-
- UseResFile(old_res);
-
-
- /* the pdl resources have been read in, now build the counter name
- tables
- */
- /* fill in the names for lap types*/
- name_counts(RES_cod(PDL_WORLD->counts[lap_cntr]),
- &my_filter.counts[lap_ty_tbi]);
- /* fill in the names for ddp types*/
- name_counts(RES_cod(PDL_WORLD->counts[ddp_cntr]),
- &my_filter.counts[ddp_ty_tbi]);
- /* fill in the names for lap types*/
- name_counts(RES_cod(PDL_WORLD->counts[misc_cntr]),
- &my_filter.counts[err_tbi]);
- }
-